function ModuleDialogPlanning(doc, container, width, height, user, date, options) {
  this._doc = doc;
  this._container = container;
  this._width = width;
  this._height = height;
  this._user = user;
  this._date = date;
  this._options = options;
  
  this._popupBox = new ModulePopupBoxSimple();
  this._object = (options && options.object) ? options.object : null;

  this._createElements();
};


ModuleDialogPlanning.prototype._createElements = function() {
  var unique = MiscUtils.unique(), _self = this;

  this._gui = new DialogPlanning(this._doc, this._container, this._width, this._height, this._user, this._date, this._options, this._data)._gui;
  
  DOMUtils.removeChildElements(this._gui.branch);
  
  this._gui.project.value = (this._object.prearrange_date != 0) ? SimpleDate.format(SimpleDate.fromStamp(this._object.prearrange_date)) : '';
  this._gui.project.onclick = function() { var context = this;
                                           _self._changeDate.call(_self, this, SimpleDate.fromStamp(_self._object.prearrange_date), function(sd) { _self._object.prearrange_date = SimpleDate.toStamp(sd); context.focus(); }, false);
                                           return false;
                                         };
  
  table = document.createElement('table');
  table.cellPadding = 0;
  table.cellSpacing = 0;
  this._gui.branch.appendChild(table);
  
  tr = table.insertRow(-1);
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  akl = DOMUtils.createInput(unique + '_check', null, 'checkbox', 'AKL', null);
  akl.checked = (this._object.ub_akl == 1);
  akl.onchange = function() { if (this.checked) {
                                  _self._object.ub_akl = 1;
                                } else {
                                  _self._object.ub_akl = 0;
                                }
                             };
  td.appendChild(akl);
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  td.style.textAlign = 'left';
  td.appendChild(document.createTextNode('AKL'));
  
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  syd = DOMUtils.createInput(unique + '_check', null, 'checkbox', 'SYD', null);
  syd.checked = (this._object.ub_syd == 1);
  syd.onchange = function() { if (this.checked) {
                                  _self._object.ub_syd = 1;
                                } else {
                                  _self._object.ub_syd = 0;
                                }
                             };
  td.appendChild(syd);
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  td.style.textAlign = 'left';
  td.appendChild(document.createTextNode('SYD'));
  
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  mel = DOMUtils.createInput(unique + '_check', null, 'checkbox', 'MEL', null);
  mel.checked = (this._object.ub_mel == 1);
  mel.onchange = function() { if (this.checked) {
                                  _self._object.ub_mel = 1;
                                } else {
                                  _self._object.ub_mel = 0;
                                }
                             };
  td.appendChild(mel);
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  td.style.textAlign = 'left';
  td.appendChild(document.createTextNode('MEL'));
  
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  nyc = DOMUtils.createInput(unique + '_check', null, 'checkbox', 'NYC', null);
  nyc.checked = (this._object.ub_nyc == 1);
  nyc.onchange = function() { if (this.checked) {
                                  _self._object.ub_nyc = 1;
                                } else {
                                  _self._object.ub_nyc = 0;
                                }
                             };
  td.appendChild(nyc);
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  td.style.textAlign = 'left';
  td.appendChild(document.createTextNode('NYC'));
  
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  bne = DOMUtils.createInput(unique + '_check', null, 'checkbox', 'BNE', null);
  bne.checked = (this._object.ub_bne == 1);
  bne.onchange = function() { if (this.checked) {
                                  _self._object.ub_bne = 1;
                                } else {
                                  _self._object.ub_bne = 0;
                                }
                             };
  td.appendChild(bne);
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  td.style.textAlign = 'left';
  td.appendChild(document.createTextNode('BNE'));
  
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  xtrao = DOMUtils.createInput(unique + '_check', null, 'checkbox', 'XTRAO', null);
  xtrao.checked = (this._object.ub_xtrao == 1);
  xtrao.onchange = function() { if (this.checked) {
                                  _self._object.ub_xtrao = 1;
                                } else {
                                  _self._object.ub_xtrao = 0;
                                }
                             };
  td.appendChild(xtrao);
  
  td = tr.insertCell(-1);
  td.style.padding = '0 1px';
  td.style.textAlign = 'left';
  td.appendChild(document.createTextNode('XTRAO'));
};

ModuleDialogPlanning.prototype._changeDate = function(label, currentDate, onChangeFunc, showTime) {
  var _self = this;
  this._wContainer = document.createElement('div');
  this._wContainer.style.left = DOMUtils.findPos(label)[0] + 'px';
  this._wContainer.style.top = DOMUtils.findPos(label)[1] + 'px';
  this._popupBox._open(this._wContainer, { pos: DOMUtils.findPos(label) });
  
  var ds = new DateSelect(currentDate, null, { container: this._wContainer, showTime: showTime });
  ds._selectFunc = function(sd) { _self._selectDate.call(_self, sd, label, onChangeFunc, showTime); };
};

ModuleDialogPlanning.prototype._selectDate = function(sd, label, onChangeFunc, showTime) {
  
  onChangeFunc(sd);
  this._showDate(sd, label, showTime);
  this._popupBox._close();
};

ModuleDialogPlanning.prototype._showDate = function(sd, label, showTime) {
  if (sd) { 
    label.value = SimpleDate.format(sd, showTime);
  } else {
    label.value = '';
  }
};